﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using _1Dot9MasterBiz;
using System.Collections;
using System.Data.SqlClient;
using System.Data;
using CKFinder;
using _1Dot9MasterCommon;

public partial class Admin_BoardWrite : AdminBasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        init();

        CKEditorControl1.config.language = "ko";     //언어설정   
        CKEditorControl1.config.enterMode = CKEditor.NET.EnterMode.BR;    // 엔터키 입력시 br태그 삽입   
        // font종류에 한글폰트 포함   
        CKEditorControl1.config.font_names = @"굴림/Gulim;돋음/Dotum;바탕/Batang;궁서/   
                                             Gungsuh;Arial/Arial;Tahoma/Tahoma;Verdana/Verdana";

        // 툴바 설정 대충 샘풀이라구 보면 된다. 없애면 전체 툴바가 다 나타난다.   
        CKEditorControl1.config.toolbar = new object[]   
        {   
           new object[] { "Source"},    
                    new object[] { "Font", "-", "FontSize"},   
           new object[] { "Bold", "Italic", "Underline", "Strike","TextColor","BGColor" },   
                    new object[] { "JustifyLeft","JustifyCenter","JustifyRight","JustifyBlock"},   
           new object[] { "Undo","Redo","-", "Link", "Unlink","Table","Image" },   
        };

        // ckfinder 설정 경로만 두곳의 경로만 잡아주면 된다.   
        CKEditorControl1.config.filebrowserImageBrowseUrl = "ckfinder/ckfinder.html?type=Images";
        CKEditorControl1.config.filebrowserImageUploadUrl = "ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Images";

    }
   
    protected void btnWrite_Click(object sender, ImageClickEventArgs e)
    {
        int result = 0;
        try
        {
            using (BoardBiz biz = new BoardBiz())
            {
                Hashtable htParams = new Hashtable();

                htParams.Add("@P_Writer", this.BoardWriter.Text);
                htParams.Add("@P_Password", this.BoardPassword.Text);
                htParams.Add("@P_Title", this.BoardTitle.Text);
                htParams.Add("@P_Message", this.CKEditorControl1.Text);

                result = biz.SetBoardNew(htParams);

                Response.Write("<script> alert('성공'); </script>");
            }
        }
        catch (Exception ex)
        {
            Response.Write("<script> alert('" + ex.Message.ToString() + "'); </script>");
        }
    }

    protected void BoardMessage_TextChanged(object sender, EventArgs e)
    {

    }

    protected void btnList_Click(object sender, EventArgs e)
    {
        //Response.Redirect("BoardList.aspx");
    }

    protected void btnModify_Click(object sender, EventArgs e)
    {

    }

    protected void btnDelete_Click(object sender, EventArgs e)
    {

    }
}